package com.itheima.mapper;

import com.itheima.entity.Comment;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentMapper {
    List<Comment> findByPage(String creatorName, String title);

    @Select("select * from tb_comment where id = #{id}")
    Comment findById(Integer id);

    void save(Comment comment);

    void update(Comment comment);

    @Delete("delete from tb_comment where id = #{id}")
    void deleteById(Integer id);

    void deleteByIds(Integer[] ids);

    @Select("select * from tb_comment where movies_id = #{moviesId}  order by time desc")
    List<Comment> findByMovieId(Integer moviesId);
}